package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInNon1008;
import com.ims.core.doc.service.ITInNon1008Service;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 过路费发票1008Controller
 *
 * @author IMS
 * @date 2024-11-20
 */
@RestController
@RequestMapping("/doc/guolufei")
public class TInNon1008Controller extends BaseController
{
    @Autowired
    private ITInNon1008Service tInNon1008Service;

    /**
     * 查询过路费发票1008列表
     */
    @PreAuthorize("@ss.hasPermi('doc:guolufei:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInNon1008 tInNon1008)
    {
        startPage();
        List<TInNon1008> list = tInNon1008Service.selectTInNon1008List(tInNon1008);
        return getDataTable(list);
    }

    /**
     * 导出过路费发票1008列表
     */
    @PreAuthorize("@ss.hasPermi('doc:guolufei:export')")
    @Log(title = "过路费发票1008", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInNon1008 tInNon1008)
    {
        List<TInNon1008> list = tInNon1008Service.selectTInNon1008List(tInNon1008);
        ExcelUtil<TInNon1008> util = new ExcelUtil<TInNon1008>(TInNon1008.class);
        util.exportExcel(response, list, "过路费发票1008数据");
    }

    /**
     * 获取过路费发票1008详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:guolufei:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInNon1008Service.selectTInNon1008ById(id));
    }

    /**
     * 新增过路费发票1008
     */
    @PreAuthorize("@ss.hasPermi('doc:guolufei:add')")
    @Log(title = "过路费发票1008", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInNon1008 tInNon1008)
    {
        return toAjax(tInNon1008Service.insertTInNon1008(tInNon1008));
    }

    /**
     * 修改过路费发票1008
     */
    @PreAuthorize("@ss.hasPermi('doc:guolufei:edit')")
    @Log(title = "过路费发票1008", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInNon1008 tInNon1008)
    {
        return toAjax(tInNon1008Service.updateTInNon1008(tInNon1008));
    }

    /**
     * 删除过路费发票1008
     */
    @PreAuthorize("@ss.hasPermi('doc:guolufei:remove')")
    @Log(title = "过路费发票1008", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInNon1008Service.deleteTInNon1008ByIds(ids));
    }
}
